	Ext.BLANK_IMAGE_URL = "../script/ext-2.0.2/resources/images/default/s.gif"; 
	
	var paramFristStore = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url: 'parameterMulti!getFristParam.action?dateTime='+new Date().getTime()}),
        reader: new Ext.data.JsonReader({
            root: 'ZANY',
            fields:["key","value"]
        }),
        remoteSort: true
    }); 
    
    var paramSecondStore = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url: 'parameterMulti!getSecondParam.action?dateTime='+new Date().getTime()}),
        reader: new Ext.data.JsonReader({
            root: 'ZANY',
            fields:["key","value"]
        }),
        remoteSort: true
    }); 
    
    paramFristStore.load();
    
    var parameterStore = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
        	url: 'parameterMulti!getList.action?dateTime='+new Date().getTime()
        }),
        reader: new Ext.data.JsonReader({
            root: 'ZANY',
            totalProperty: "results",
            fields:["optionText","optionValue","seq","seqMult"]
        }),
        sortInfo:{field:'seq', direction:'ASC'},// 排序信息
        remoteSort: true
    });
    
	var paramFrist = new Ext.form.ComboBox({
         id:'paramFrist',
		 name:'paramFrist',
		 fieldLabel: '参数组',
         hiddenName: 'frist',
         store: paramFristStore,
         valueField:'key',
         displayField:'value',
         typeAhead: true,
         mode: 'local',
         triggerAction: 'all',
         resizable:true,
         emptyText:'请选择参数组...',
         allowBlank:false,
         width : 150,
         listeners: {collapse:getParamSecond},
         forceSelection:true					
  		 });
  		 
  	var paramSecond = new Ext.form.ComboBox({
         id:'paramSecond',
		 name:'paramSecond',
		 fieldLabel: '参数',
         hiddenName: 'second',
         store: paramSecondStore,
         valueField:'key',
         displayField:'value',
         typeAhead: true,
         mode: 'local',
         triggerAction: 'all',
         resizable:true,
         emptyText:'请选择参数...',
         allowBlank:true,
         width : 150,
         forceSelection:true					
  		 });
  		 
	function getParamSecond(){
		var params={};
	    params.paramType = paramFrist.getValue();
	    paramSecondStore.baseParams=params;
	    paramSecondStore.load({
	    	callback : function(r, options, success) {   
		        if (success == false) {   
		            Ext.Msg.alert("错误", paramSecondStore.reader.jsonData.msg);
		        }   
		    }
		});
	}
	
	var colParam=new Ext.grid.ColumnModel([
		{header:"参数名",dataIndex:"optionText",width:100,sortable:true},
		{header:"参数值",dataIndex:"optionValue",width:100,sortable:true}
		]);
	
	var oneTbar = new Ext.Toolbar({   
        items: ['-',{text:'&nbsp;&nbsp;查&nbsp;&nbsp;询&nbsp;&nbsp;',iconCls:'yes',handler:getList},
			    '-',{text:'&nbsp;&nbsp;添&nbsp;&nbsp;加&nbsp;&nbsp;',iconCls:'add',handler:insertinfo}
        	   ]   
    });
    	
	var parameterManage = new Ext.grid.GridPanel({
		id:'parameterManage',
		title :'[多值参数管理]信息维护',
		height:500,
		stripeRows :true,
		bodyStyle:'width:100%',
        disableSelection:true,
		cm: colParam,
		viewConfig: {
            forceFit:true
        },
		store: parameterStore,
		iconCls: 'details',
		animCollapse: true,
		trackMouseOver:false, 
        loadMask: {msg:'正在加载[培训管理]信息，请稍侯……'},
		tbar:['-',new Ext.form.Label({text:'参数组:'}),'-',paramFrist,
			  '-',new Ext.form.Label({text:'参数：'}),'-',paramSecond
		],
		listeners:{  
			'render':function(){   
				oneTbar.render(this.tbar); //add one tbar        
			}
		},
	});
    
	var fp = new Ext.FormPanel({
						id:'ext_form',
				        labelWidth: 90, 
				        waitMsg:'正在提交，请稍后...',
				        frame:true,
				        bodyStyle:'padding:5px 5px 0',
				        width: 500,
				        reader: new Ext.data.JsonReader({
				            root: 'ZANY',
				            totalProperty: "results",
				            fields:["optionText","optionValue"]
				        }),
				        items: [{
				        		 layout:'column',
							     layout: 'form',
							     defaultType: 'textfield',
							     items: [{
											fieldLabel: '参数名',
											name: 'optionText',
											id:'optionText',
											maxLength:20,
											anchor:'95%',
											allowBlank:false
						                },
						                {
											fieldLabel: '参数值',
											name: 'optionValue',
											id:'optionValue',
											maxLength:20,
											anchor:'95%',
											allowBlank:false
						                },
						                new Ext.form.Hidden({name:'paramCode'})	
								        ]
				        	}] 
	    			});
	    			
	var winKey =new Ext.Window({
		id:"ext_win",
    	title: '[多值参数]',
		width:500,
		closeAction:'hide',
		modal:true,
		iconCls: 'add',
		buttons: [{
            text: '提交',
            handler: function(){
            	if(fp.form.isValid()){
            	
            		fp.form.submit({
	                    url: 'parameterMulti!insert.action?dateTime='+new Date().getTime(),
						waitTitle:"多值参数",
	                    waitMsg: '正在提交数据,请稍后... ...',
	                    success: function(){
							Ext.getCmp('parameterManage').getStore().reload(); 
							fp.form.reset();
			                parameterStore.modified = [];
							Ext.MessageBox.alert('提示信息', '新增多值参数信息成功！'); 
							winKey.hide();
						},
						failure:function(form,action){
							Ext.MessageBox.alert('提示信息', '新增多值参数信息失败,请联系系统管理员!'+action.result.msg);
						}
	                });
            	}else{
            		ZANY.util.Msg('添加提示','数据不完整！');
            	}
            }
        },{
            text: '取消',handler: function(){winKey.hide();fp.form.reset();}
        }],
		items:[fp]	
	});
					
	function insertinfo(){
		var paramType = paramFrist.getValue();
		var paramCode = paramSecond.getValue();	
		if(paramType==""||paramCode==""){
			ZANY.util.Msg('添加提示','请选择参数及参数组！');
			return false;
		}
		if(paramCode.substr(0, paramCode.length-3)!=paramType){
			ZANY.util.Msg('添加提示','请正确选择参数及参数组！');
			return false;
		}
		winKey.show();	
		fp.getForm().findField("paramCode").setValue(paramCode);
    }
    
	function getList(){
		var paramType = paramFrist.getValue();
		var paramCode = paramSecond.getValue();	
		if(paramType==""||paramCode==""){
			ZANY.util.Msg('添加提示','请选择参数及参数组！');
			return false;
		}
		if(paramCode.substr(0, paramCode.length-3)!=paramType){
			ZANY.util.Msg('添加提示','请正确选择参数及参数组！');
			return false;
		}
		var params={};
	    params.paramCode = paramCode;
	    parameterStore.baseParams=params;
	    parameterStore.load({
	    	callback : function(r, options, success) {   
		        if (success == false) {   
		            Ext.Msg.alert("错误", parameterStore.reader.jsonData.msg);
		        }   
		    }
		});
	}
	
	Ext.onReady(function(){
		Ext.QuickTips.init(); 
	　　 Ext.form.Field.prototype.msgTarget = 'side';
			var port = new Ext.Viewport({
				layout : 'fit',
				frame : true,
				items : [this.parameterManage]
	    	});
	});